<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 数组解构
        function swap([x, y]) {
            return [y, x];
        }
        let arr = [1, 2];
        arr = swap(arr);
        console.log(arr);
        // 对象的解构赋值
        function Computer({
            cpu,
            menu,
            name = ['ie3'],
            OS = 'win32'
        }) {
            console.log(cpu);
            console.log(menu);
            console.log(name);
            console.log(OS);
        }
        Computer({
            menu: '128888g',
            cpu: 'intel I5',
            OS: 'win32'
        })
    </script>
</body>

</html>